package com.jxmcloud.business.cut.controller.app.provider;

import com.jxmcloud.business.cut.constants.CutApi;
import com.jxmcloud.business.cut.dtoCommon.AccountInfoDto;
import com.jxmcloud.business.cut.service.provider.IUserCutInfoService;
import com.xlcloud.platform.api.exception.BusinessException;
import com.xlcloud.platform.util.RUtil;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;


@Slf4j
@RestController
@RequestMapping(CutApi.APP_CUT_USER_ACTIVITY_LOG)
public class UserActivityLogController {
    @Resource
    private IUserCutInfoService userCutInfoService;


    // 通知用户唤醒砍一刀
    @PostMapping("/notice")
    public String getCutInfoBuyUser(@RequestBody AccountInfoDto dto) {
        try {
            String cutInfoBuyUser = userCutInfoService.getCutInfoBuyUser(dto);
            return RUtil.appSuccess(cutInfoBuyUser);
        } catch (BusinessException e) {
            log.error("请求失败{}",e);
            return RUtil.appFail(e.getMessage());
        } catch (Exception e) {
            log.error("请求失败{}",e);
            return RUtil.appFail("请求失败!");
        }
    }
}
